Skip to content

Conversation

@MuriloFP
Copy link
Contributor

@MuriloFP MuriloFP commented Jul 31, 2025

Description

Fixes #6493

This PR adds mode display indicators to task cards in both the main chat screen and history view, allowing users to quickly identify which mode was used for each task.

Changes Made

  • Created ModeBadge component that displays mode names with proper VSCode theme styling
  • Updated TaskItemHeader to show mode badge next to timestamp in history view
  • Updated TaskHeader to display mode badge in main chat header area
  • Added comprehensive unit tests for the ModeBadge component (14 tests covering all scenarios)

Testing

  • All existing tests pass
  • Added 14 unit tests for ModeBadge component
  • Manual testing completed:
    • Mode badges display correctly in history view
    • Mode badges display correctly in main chat view
    • Custom modes without emojis display properly
    • Long mode names truncate with ellipsis
    • Full mode name shows on hover via tooltip
    • Tasks without mode information show no badge

Verification of Acceptance Criteria

  • Mode indicators appear on task cards in history view for tasks with mode information
  • Mode indicators appear in main chat header for active tasks
  • Tasks without mode information display normally without any badge
  • Custom modes with long names truncate appropriately with ellipsis
  • Full name is available via tooltip on hover
  • Custom modes without emojis display correctly

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated (if needed)
  • No breaking changes
  • Accessibility checked (tooltips for truncated text)

Screenshots/Demo

History View

Mode badges now appear next to the timestamp on task cards in the history view.

Main Chat View

Mode badge displays in the task header area, making it easy to see which mode is being used for the current task.

The implementation handles all edge cases including deleted custom modes (shows slug as fallback), long mode names (truncates with ellipsis), and ensures no empty badges appear for legacy tasks without mode data.


Important

Add ModeBadge component to display mode indicators on task cards in main chat and history views, with comprehensive testing.

  • Components:
    • Add ModeBadge component in ModeBadge.tsx to display mode names with VSCode theme styling.
    • Update TaskHeader.tsx to include ModeBadge next to the timestamp in the main chat view.
    • Update TaskItemHeader.tsx to include ModeBadge in the history view.
  • Testing:
    • Add 14 unit tests for ModeBadge in ModeBadge.spec.tsx covering scenarios like long names, missing data, and custom classes.
  • Behavior:
    • Mode badges display in both main chat and history views.
    • Long mode names truncate with ellipsis, full name available on hover.
    • Tasks without mode data show no badge.

This description was created by Ellipsis for f258f49. You can customize this summary. It will automatically update as commits are pushed.

MuriloFP and others added 30 commits July 3, 2025 15:26
- Created ModeBadge component to display mode names with proper styling
- Updated TaskItemHeader to show mode badge next to timestamp in history view
- Updated TaskHeader to display mode badge in main chat view
- Added comprehensive unit tests for ModeBadge component
- Handles custom modes, deleted modes, and long mode names with truncation
- Only displays badge when mode information exists (no empty badges)
@MuriloFP MuriloFP requested review from cte, jr and mrubens as code owners July 31, 2025 18:55
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused labels Jul 31, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found some issues that need attention. The implementation correctly addresses the issue requirements and includes comprehensive testing, but there are import path and styling concerns that should be addressed.

@@ -0,0 +1,42 @@
import React from "react"
import { getModeBySlug } from "@roo/modes"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import path inconsistency detected. This uses while the rest of the codebase uses or patterns. Could we update this to match the project's import conventions?

const displayName = mode?.name || modeSlug

// Truncate long mode names
const truncatedName = displayName.length > 20 ? `${displayName.substring(0, 17)}...` : displayName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hard-coded truncation logic (20 characters, 17 + "...") might not work well for all languages or use cases. Could we consider making this configurable or using CSS for better performance and consistency?

<StandardTooltip content={displayName}>
<Badge
variant="outline"
className={cn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styling overrides here conflict with the Badge variant's default styling. This could break visual consistency across the app. Is there a way to work with the existing Badge variants instead of overriding them?

const mode = getModeBySlug(modeSlug, customModes)

// If mode is not found (e.g., deleted custom mode), show the slug as fallback
const displayName = mode?.name || modeSlug
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback to showing the raw slug might be confusing for users. Could we consider a more user-friendly fallback like "Unknown mode" or hide the badge entirely for deleted modes?

// Mock dependencies
vi.mock("@roo/modes")
vi.mock("@/context/ExtensionStateContext")
vi.mock("@/components/ui", () => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mocking the entire module could be brittle. Could we consider more targeted mocks for just the components we need to test?

@MuriloFP MuriloFP marked this pull request as draft July 31, 2025 19:00
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 31, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jul 31, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 31, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add mode display indicators on task cards (main screen and history)

2 participants